<?php
App::uses('AppModel', 'Model');
/**
 * Projeto Model
 *
 */
class Projeto extends AppModel {
	public $displayField = 'nome';
/**
 * Validation rules
 *
 * @var array
 */
	public $validate = array(
		'nome' => array(
			'notempty' => array(
				'rule' => array('notempty'),
				'message' => 'É obrigatório o preenchimento do nome do projeto',
				'allowEmpty' => false,
				'required' => true,
				//'last' => false, // Stop validation after this rule
				//'on' => 'create', // Limit validation to 'create' or 'update' operations
			),
		),
		'coordenador_id' => array(
			'notempty' => array(
					'rule' => array('notempty'),
					'message' => 'É obrigatório o preenchimento do coordenador',
					'allowEmpty' => false,
					'required' => true,
					//'last' => false, // Stop validation after this rule
					//'on' => 'create', // Limit validation to 'create' or 'update' operations
			),
		),
		'data_inicio' => array(
			'date' => array(
				'rule' => array('date'),
				'message' => 'Informe uma data válida',
				'allowEmpty' => false,
				'required' => true,
				//'last' => false, // Stop validation after this rule
				//'on' => 'create', // Limit validation to 'create' or 'update' operations
			),
		),
		'data_termino' => array(
			'date' => array(
				'rule' => array('date'),
				'message' => 'Informe uma data válida',
				'allowEmpty' => false,
				'required' => true,
				//'last' => false, // Stop validation after this rule
				//'on' => 'create', // Limit validation to 'create' or 'update' operations
			),
		),
	);
	
	public $belongsTo = array(
		'Usuario' => array(
				'className' => 'Usuario',
				'foreignKey' => 'coordenador_id',
				'conditions' => '',
				'fields' => '',
				'order' => ''
		),
	);
			
}